<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1.创建数组
        // let n = Array(7,8)
        // let a = Array.of(111,2,33)
        // console.log(n,a)

        // 2.find查找某一项
        // let arr = [1,2,3,4,5,6.8,8.10]
        // let res = arr.find(item => item % 2 == 0)
        // console.log(res)
        // let result = arr.filter(item => item % 2 ==0)
        // console.log(result)

        // 3.findIndex 查找某个值的索引
        // let arr = ['卡莎', '莎米拉', '拉克丝', 2, 4]
        // let res = arr.findIndex(item => item = '卡莎')
        // let result = arr.findIndex(item => item%2 == 0)
        // console.log(res, result)

        // 5.includes 判断数组里面是否包含某个值
        // let arr = ['卡莎', 3, 56, "莎米拉"]
        // let a = arr.includes('卡莎')
        // console.log(a)

        // 6.flat数组扁平化，将数组降维
        // let arr = [1,2,3,[1,[3]]]
        // let res = arr.flat(2)
        // console.log(res)

        // 7.at()获取数组某一项，参数传索引，可以为负数表示从后往前
        // let arr = [1, 2, 3, 4, 5, 11]
        // let res = arr.at(-1)
        // console.log(res) //11

        // 8.fill填充数组(会修改原数组)
        let arr =[1, 2, 3, 4, 5]
        let res = arr.fill(5)
        console.log(res)
        let result = arr.fill('aaa', 2, 3)//第一个参数传填充的元素，后两个传索引，前闭后开
        console.log(result)



    </script>
</body>
</html>